/*
 ------------------------------------------------------------------------------
 Copyright (C) 1996-2001 Id Software, Inc.

 This file is part of the Quake source code.

 The Quake source code is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your
 option) any later version.

 The Quake source code is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 more details.

 You should have received a copy of the GNU General Public License along with
 the Quake source code; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 ------------------------------------------------------------------------------
*/


//
// sphere.cpp - sphere math library
//


#include "../shared.h"


glqSphere	sphere_zero(0.0f, 0.0f, 0.0f, 0.0f);


/*
 ==================
 glqSphere::ToVec4
 ==================
*/
glqVec4 glqSphere::ToVec4 (void) const {

	return glqVec4(center.x, center.y, center.z, radius);
}

/*
 ==================
 glqSphere::FromVec4
 ==================
*/
void glqSphere::FromVec4 (const glqVec4 &vec){

	center.x = vec.x;
	center.y = vec.y;
	center.z = vec.z;
	radius = vec.w;
}

/*
 ==================
 glqSphere::ToBounds
 ==================
*/
glqBounds glqSphere::ToBounds (void) const {

	return glqBounds(center, radius);
}

/*
 ==================
 glqSphere::ToString

 This is just a convenience function for printing spheres
 ==================
*/
const char *glqSphere::ToString (int precision) const {

	return Str_FromFloatArray(ToFloatPtr(), 4, precision);
}